package com.world.blog.service.impl;

import java.util.List;
import com.world.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.world.blog.mapper.FriendLinkMapper;
import com.world.blog.domain.BlogFriendLink;
import com.world.blog.service.IBlogFriendLinkService;

/**
 * 友链Service业务层处理
 * 
 * @author LiJunXi
 * @date 2025-05-25
 */
@Service
public class BlogFriendLinkServiceImpl implements IBlogFriendLinkService
{
    @Autowired
    private FriendLinkMapper friendLinkMapper;

    /**
     * 查询友链
     * 
     * @param linkId 友链主键
     * @return 友链
     */
    @Override
    public BlogFriendLink selectFriendLinkByLinkId(Long linkId)
    {
        return friendLinkMapper.selectFriendLinkByLinkId(linkId);
    }

    /**
     * 查询友链列表
     * 
     * @param blogFriendLink 友链
     * @return 友链
     */
    @Override
    public List<BlogFriendLink> selectFriendLinkList(BlogFriendLink blogFriendLink)
    {
        return friendLinkMapper.selectFriendLinkList(blogFriendLink);
    }

    /**
     * 新增友链
     * 
     * @param blogFriendLink 友链
     * @return 结果
     */
    @Override
    public int insertFriendLink(BlogFriendLink blogFriendLink)
    {
        blogFriendLink.setCreateTime(DateUtils.getNowDate());
        return friendLinkMapper.insertFriendLink(blogFriendLink);
    }

    /**
     * 修改友链
     * 
     * @param blogFriendLink 友链
     * @return 结果
     */
    @Override
    public int updateFriendLink(BlogFriendLink blogFriendLink)
    {
        blogFriendLink.setUpdateTime(DateUtils.getNowDate());
        return friendLinkMapper.updateFriendLink(blogFriendLink);
    }

    /**
     * 批量删除友链
     * 
     * @param linkIds 需要删除的友链主键
     * @return 结果
     */
    @Override
    public int deleteFriendLinkByLinkIds(Long[] linkIds)
    {
        return friendLinkMapper.deleteFriendLinkByLinkIds(linkIds);
    }

    /**
     * 删除友链信息
     * 
     * @param linkId 友链主键
     * @return 结果
     */
    @Override
    public int deleteFriendLinkByLinkId(Long linkId)
    {
        return friendLinkMapper.deleteFriendLinkByLinkId(linkId);
    }
}
